package com.gz.dto;

import java.math.BigDecimal;
import java.util.Date;
import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import com.gz.utils.DataFmtUtil;

/**
 * 用户答题结果详情表(UserAnswers)实体参数类
 *
 * @author makejava
 * @since 2024-05-27 15:40:59
 */
@Data
@ApiModel("用户答题结果详情表参数类")
public class UserAnswersDto extends PageInfoDto implements Serializable {
    private static final long serialVersionUID = 393981679504200564L;
    private Integer id;
    @ApiModelProperty("答案id")
    private Integer answerId;
    @ApiModelProperty("题目id")
    private Integer questionId;
    @ApiModelProperty("用户答案")
    private String userAnswer;
    @ApiModelProperty("是否正确")
    private Integer isCorrect;
    @ApiModelProperty("题目总分")
    private Double totalScore;
    @ApiModelProperty("提交时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date submitTime;
    @ApiModelProperty("题目答案")
    private String questionAnswer;
    @ApiModelProperty("学生得分")
    private BigDecimal getScore;
    @ApiModelProperty("排序字段")
    private String orderField;
    @ApiModelProperty("排序类型")
    private String orderType;

    public String getOrderField() {
        if (!StringUtils.isEmpty(orderField)) {
            return DataFmtUtil.xX2x_x(orderField);
        }
        return orderField;
    }
}

